import request from '@/utils/request'
// 客情关怀接口列表

// 关怀客户列表
export function careCustomerList(data) {
  return request({
    url: '/call-center/api/v1/careCustomerInfo/',
    method: 'get',
    data: data
  })
}

// 关怀客户保存
export function careCustomerAdd(data) {
  return request({
    url: '/call-center/api/v1/careCustomerInfo',
    method: 'post',
    data: data
  })
}

/**
 * 关怀客户详情
 * @param {string} id 客户信息ID
 */
export function careCustomerDetail(id) {
  return request({
    url: `/call-center/api/v1/careCustomerInfo/${id}`,
    method: 'get'
  })
}

// 关怀客户修改
export function careCustomerUpdate(data) {
  return request({
    url: '/call-center/api/v1/careCustomerInfo',
    method: 'post',
    data
  })
}

// 关怀客户删除
export function careCustomerDelete(id) {
  return request({
    url: '/call-center/api/v1/careCustomerInfo/' + id,
    method: 'delete'
  })
}

// 关怀客户删除批量
export function careCustomerDeleteBatch(ids) {
  return request({
    url: '/call-center/api/v1/careCustomerInfo/deleteBatch',
    method: 'delet',
    data: { ids }
  })
}

/**
 * 停用
 * @param {string} id 客户ID
 */
export function careCustomerInfoDisable(id) {
  return request({
    url: `/call-center/api/v1/careCustomerInfo/disable/${id}`,
    method: 'put'
  })
}
/**
 * 批量停用
 * @param {string} ids 客户ID
 */
export function careCustomerInfoDisableBat(ids) {
  return request({
    url: `/call-center/api/v1/careCustomerInfo/disable`,
    method: 'put',
    data: ids
  })
}

/**
 * 启用
 * @param {string} id 客户ID
 */
export function careCustomerInfoEnable(id) {
  return request({
    url: `/call-center/api/v1/careCustomerInfo/enable/${id}`,
    method: 'put'
  })
}
/**
 * 批量启用
 * @param {string} ids 客户ID
 */
export function careCustomerInfoEnableBat(ids) {
  return request({
    url: `/call-center/api/v1/careCustomerInfo/enable`,
    method: 'put',
    data: ids
  })
}

// 关怀客户导出
export function careCustomerExport(data) {
  return request({
    url: '/call-center/api/v1/careCustomerInfo/export',
    method: 'post',
    data,
    responseType: 'blob',
    timeout: 10 * 60 * 1000
  })
}
// 关怀客户导入
export function careCustomerImport(data) {
  return request({
    url: '/call-center/api/v1/careCustomerInfo/import',
    method: 'post',
    data,
    timeout: 10 * 60 * 1000
  })
}
// 客情任务列表
export function careTaskList() {
  return request({
    url: '/call-center/api/v1/careTask/page',
    method: 'post'
  })
}

/**
 * 新增任务
 * @param {body} data 新增任务数组
 */
export function careTaskAdd(data) {
  return request({
    url: '/call-center/api/v1/careTask/create',
    method: 'post',
    data
  })
}
/** 新增顾客关怀任务 */
export function postConsumerCareTask(data) {
  return request({
    url: '/call-center/api/v1/careTask/consumerCareTask',
    method: 'POST',
    data
  })
}
/** 新增商家任务 */
export function postDealerCareTask(data) {
  return request({
    url: '/call-center/api/v1/careTask/dealerCareTask',
    method: 'POST',
    data
  })
}
/** 变更处理坐席 */
export function postChangeSeats(data) {
  return request({
    url: '/call-center/api/v1/careTask/changeSeats',
    method: 'PUT',
    data
  })
}
/**
 * 新增下月任务
 */
export function postDealerNextMonthCareTask() {
  return request({
    url: `/call-center/api/v1/careTask/dealerNextMonthCareTask`,
    method: 'post'
  })
}
/**
 * 新增指定月份任务
 */
export function dealerMonthCareTask(localDate) {
  return request({
    url: `/call-center/api/v1/careTask/dealerMonthCareTask?localDate=${localDate}`,
    method: 'post'
  })
}
/**
 * 查看任务
 * @param {string} id 任务ID
 */
export function careTaskDetail(id) {
  return request({
    url: `/call-center/api/v1/careTask/${id}`,
    method: 'get'
  })
}

/**
 * 修改任务
 * @param {body} data data
 */
export function careTaskUpdate(data) {
  return request({
    url: '/call-center/api/v1/careTask/handler',
    method: 'put',
    data
  })
}

/**
 * 保存任务
 * @param {query} params params
 */
export function careTaskSave(data) {
  return request({
    url: `/call-center/api/v1/careTask/save`,
    method: 'put',
    data
  })
}

/**
 * 提交任务
 * @param {query} params params
 */
export function careTaskSubmit(data) {
  return request({
    url: `/call-center/api/v1/careTask/submit`,
    method: 'put',
    data
  })
}

// 任务删除
export function careTaskDelete(id) {
  return request({
    url: '/call-center/api/v1/careTask/' + id,
    method: 'delete'
  })
}

/**
 * 关闭单个任务
 * @param {string} id 任务ID
 */
export function careTaskClose(id) {
  return request({
    url: `/call-center/api/v1/careTask/close`,
    method: 'put',
    data: {
      id
    }
  })
}

/**
 * 批量关闭任务
 * @param {array} ids 任务ID数组
 */
export function careTaskCloseBatch(ids) {
  return request({
    url: `/call-center/api/v1/careTask/closeBatch`,
    method: 'delete',
    data: ids
  })
}

/** 导出 */
export function postExport(data) {
  return request({
    url: '/call-center/api/v1/careTask/export',
    method: 'POST',
    data,
    responseType: 'blob',
    timeout: 10 * 60 * 1000
  })
}

// 任务删除批量
export function careTaskDeleteBatch(ids) {
  return request({
    url: '/call-center/api/v1/careTask/deleteBatch',
    method: 'delete',
    data: { ids }
  })
}

/**
 * 工单关怀任务
 * @param {body} data data
 */
export function workOrderCareTask(data) {
  return request({
    url: `/call-center/api/v1/careTask/workOrderCareTask`,
    method: 'post',
    data
  })
}

/** 保存礼物 */
export function saveGift(data) {
  return request({
    url: '/call-center/api/v1/careTask/saveGift',
    method: 'PUT',
    data
  })
}
/** 提交礼物 */
export function submitGift(data) {
  return request({
    url: '/call-center/api/v1/careTask/submitGift',
    method: 'PUT',
    data
  })
}
/** 删除附件 */
export function deleteAnnex(id) {
  return request({
    url: `/call-center/api/v1/careTask/${id}`,
    method: 'delete'
  })
}
